<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// Route::get('think', function () {
//     return 'hello,ThinkPHP5!';
// });

// Route::get('hello/:name', 'index/hello');

// return [

// ];

// Route::rule('/a','home/index/index');
// Route::get('/a','home/index/index');

// use think\console\command\optimize\Route; 
// 这里写的是前缀

Route::domain('www',function(){
    //后台首页
    Route::get('/','adminapi/index/index');
    //获取验证码的接口
    Route::get('/admin/captcha','adminapi/login/captcha')->allowCrossDomain();
    //登录接口
    Route::post('login','adminapi/login/login')->allowCrossDomain();
/////////////角色部分////////////////////////////////////
    // 管理员接口
    Route::get('admin','adminapi/admin/index')->allowCrossDomain();
    //添加用户
    Route::post('add','adminapi/admin/add')->allowCrossDomain();
    //修改用户信息
    Route::post('edit','adminapi/admin/edit')->allowCrossDomain();
    //删除用户信息
    Route::post('delete','adminapi/admin/delete')->allowCrossDomain();
/////////////角色部分////////////////////////////////////
    //角色接口
    Route::get('role','adminapi/role/index')->allowCrossDomain();
    //修改用户信息
    Route::post('roleedit','adminapi/role/edit')->allowCrossDomain();
/////////////权限部分////////////////////////////////////
    Route::get('auth','adminapi/auth/index')->allowCrossDomain();
    // 添加权限
    Route::post('authadd','adminapi/auth/add')->allowCrossDomain();
/////////////商品部分////////////////////////////////////
    Route::get('goods','adminapi/goods/index')->allowCrossDomain();
    // 上传文件
    Route::post('logo','adminapi/goods/upload')->allowCrossDomain();
    // 添加商品
    Route::post('goodsadd','adminapi/goods/add')->allowCrossDomain();
});
Route::domain('home',function(){
    Route::get('/','home/index/index');
    Route::get('/login','home/login/login');
    Route::get('/register','home/login/register');
    Route::get('/myself','home/users/userself');
});
